package drds.data_propagate.server;

import drds.data_propagate.server.exception.DataPropagateServerException;
import drds.propagate.protocol.ClientId;
import drds.propagate.protocol.Message;

import java.util.concurrent.TimeUnit;

public interface CanalService {

    void subscribe(ClientId clientId) throws DataPropagateServerException;

    void unsubscribe(ClientId clientId) throws DataPropagateServerException;

    Message get(ClientId clientId, int batchSize) throws DataPropagateServerException;

    Message get(ClientId clientId, int batchSize, Long timeout, TimeUnit unit) throws DataPropagateServerException;

    Message getWithoutAck(ClientId clientId, int batchSize) throws DataPropagateServerException;

    Message getWithoutAck(ClientId clientId, int batchSize, Long timeout, TimeUnit unit)
            throws DataPropagateServerException;

    void ack(ClientId clientId, long batchId) throws DataPropagateServerException;

    void rollback(ClientId clientId) throws DataPropagateServerException;

    void rollback(ClientId clientId, Long batchId) throws DataPropagateServerException;
}
